import requests
import time
import execjs
# 通过多次请求发现仅rsainfo，signature和timestamp会发生变化，时间戳转换发现为当前时间
timestamp = int(time.time())
with open(r'E:\Python\vscode\Crawlers\js逆向\09挑战\tz_a.js', 'r', encoding='utf-8') as f:
    js = execjs.compile(f.read())
sign_data = js.call('querySiteAll')
print(sign_data)
headers = {
    "apikey;": "",
    "authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9",
    "fid": "b64d624d9acd1aa629a8ca8cd3faff47",
    "rsainfo": sign_data['rsainfo'],
    "signature": sign_data['signature'],
    "timestamp": str(sign_data['timestamp']),
    "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36",
    "vid": "b64d624d9acd1aa629a8ca8cd3faff47"
}
url = "https://yubin-fuwu.top/api-net/site/querySiteAll"
params = {
    "keyword": ""
}
response = requests.get(url, headers=headers, params=params)

print(response.text)
print(response)